|
|
|
|
|
|
|
Built-in Visual Basic Functions |
|
|
|
|
|
|
|
|
Instead of using the Windows API calls, you can just use Visual Basics built-in functions to manipulate the area in the Registry in the HKEY_CURRENT_USER\Software\VB and VBA Program Settings key: |
|
|
|
 |
|
|
|
|
HKEY_CURRENT_USER
\Software
\VB and VBA Program Settings
\ConfigName
\Section
\KeyName |
|
|
|
|
|
|
|
|
The functions youll use to manipulate this area of the Registry are GetSetting, SaveSetting, DeleteSetting, and GetAllSettings. |
|
|
|
|
|
|
|
|
The GetSetting() function returns a single data value to you when you pass in the ConfigName, Section, and KeyName values for where you want to get the data. Look in the Click of the GetSetting command button to see the following code: |
|
|
|
 |
|
|
|
|
Private Sub cmdGetSetting_Click()
txtKeyValue = GetSetting(txtConfig, _
txtSection, _
txtKeyName, _
"Can't Find Entry")
End Sub |
|
|
|
|
|
|
|
|
The last parameter of the GetSetting() function is a default value in case the entry youre requesting cant be found. |
|
|
|
|
|
|
|
|
SaveSetting places a single data value in the Registry at the location specified by the ConfigName, Section, and KeyName values. Look at the code in the SaveSetting command button to see the following code: |
|
|
|
 |
|
|
|
|
Private Sub cmdSaveSetting_Click()
SaveSetting txtConfig, _
txtSection, _ |
|
|
|
|
|